<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>橡树科技－JavaDemoSystem</title>
    <link type="text/css" rel="stylesheet" media="all" href="/static/styles/global.css"/>
    <link type="text/css" rel="stylesheet" media="all" href="/static/styles/global_color.css"/>
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#idcardNo").blur(function () {
               var IdcordNo = $("#idcardNo").val();
                $.ajax({
                    url: "/account/accountIdcordNo",
                    type:"post",
                    data:{"IdcordNo":IdcordNo},
                    success:function (resultMap) {
                        if (resultMap.code == 1001) {
                            $("#idcardNoError_msg").show()
                            $("#idcardNo_msg").hide()
                            document.getElementById("submit").disabled = true;
                        }else {
                            $("#idcardNoError_msg").show()
                            $("#idcardNoError_msg").hide()
                        }
                    }
                });
            })
        })
    </script>
    <script language="javascript" type="text/javascript">
        //保存成功的提示信息
        function showResult() {
            showResultDiv(true);
            window.setTimeout("showResultDiv(false);", 3000);
        }

        function showResultDiv(flag) {
            var divResult = document.getElementById("save_result_info");
            if (flag)
                divResult.style.display = "block";
            else
                divResult.style.display = "none";
        }

        //显示选填的信息项
        function showOptionalInfo(imgObj) {
            var div = document.getElementById("optionalInfo");
            if (div.className == "hide") {
                div.className = "show";
                imgObj.src = "/static/images/hide.png";
            }
            else {
                div.className = "hide";
                imgObj.src = "/static/images/show.png";
            }
        }

        function pwd() {
            var newpwd = document.getElementById("newpwd").value;
            var newpwd2 = document.getElementById("newpwd2").value;
            if ((newpwd == newpwd2) && (newpwd != "")) {
                document.getElementById("tishi").innerHTML = "<br><font color='green'>可用</font>";
                document.getElementById("submit").disabled = false;
            } else if (newpwd == "" || newpwd2 == "") {
                document.getElementById("tishi").innerHTML = "<br><font color='red'>密码不能为空!</font>";
                document.getElementById("submit").disabled = true;
            } else if (newpwd != newpwd2) {
                document.getElementById("tishi").innerHTML = "<br><font color='red'>两次输入密码不一致!</font>";
                document.getElementById("submit").disabled = true;
            }
        }

        //身份证验证
        function idcardno(card) {
            // 身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X
            var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
            if(reg.test(card) === false) {
                alert("身份证输入不合法");
                document.getElementById("submit").disabled = true;
                return  false;
            }
        }
    </script>
</head>
<body>

<div id="header">
    <img src="/static/images/logo.png" alt="logo" class="left"/>
    <a href="#">[退出]</a>
</div>


<div id="navi">
    <ul id="menu">
        <li><a href="../index.html" class="index_off"></a></li>
        <li><a href="../role/role_list.html" class="role_off"></a></li>
        <li><a href="../admin/admin_list.html" class="admin_off"></a></li>
        <li><a href="../fee/fee_list.html" class="fee_off"></a></li>
        <li><a href="/account/account_list" class="account_on"></a></li>
        <li><a href="../service/service_list.html" class="service_off"></a></li>
        <li><a href="../bill/bill_list.html" class="bill_off"></a></li>
        <li><a href="../report/report_list.html" class="report_off"></a></li>
        <li><a href="../user/user_info.html" class="information_off"></a></li>
        <li><a href="../user/user_modi_pwd.html" class="password_off"></a></li>
    </ul>
</div>


<div id="main">

    <form id="addDetail" action="/account/account_addDetail" method="post" class="main_form">
        <div class="text_info clearfix"><span>姓名：</span></div>
        <div class="input_info">
            <input type="text" value="${account.realName}" name="realName"/>
            <span class="required">*</span>
            <div class="validate_msg_long">20长度以内的汉字、字母和数字的组合</div>
        </div>

        <div class="text_info clearfix"><span>身份证：</span></div>
        <div class="input_info">
            <input type="text" id="idcardNo" value="${account.idcardNo}" name="idcardNo" onblur="idcardno(this.value)"/>
            <span id="idcardNoError_msg" hidden="hidden" style="color: red;">身份证已被使用</span>
            <span id="idcardNo_msg" hidden="hidden" style="color: green;">可用</span>
            <span class="required">*</span>
            <div class="validate_msg_long">正确的身份证号码格式</div>
        </div>

        <div class="text_info clearfix"><span>登录账号：</span></div>
        <div class="input_info">
            <input type="text" value="${account.loginName}" name="loginName"/>
            <span class="required">*</span>
            <div class="validate_msg_long">30长度以内的字母、数字和下划线的组合</div>
        </div>

        <div class="text_info clearfix"><span>密码：</span></div>
        <div class="input_info">
            <input type="password" id="newpwd" name="loginPasswd"/>
            <span class="required">*</span>
            <div class="validate_msg_long">30长度以内的字母、数字和下划线的组合</div>
        </div>

        <span id="tishi" style="margin-left: 20px;"></span>
        <div class="text_info clearfix"><span>重复密码：</span></div>
        <div class="input_info">
            <input type="password" id="newpwd2" onblur="pwd()"/>
            <span class="required">*</span>
            <div class="validate_msg_long">两次密码必须相同</div>
        </div>

        <div class="text_info clearfix"><span>电话：</span></div>
        <div class="input_info">
            <input type="text" class="width200" value="${account.telephone}" name="telephone"/>
            <span class="required">*</span>
            <div class="validate_msg_medium">正确的电话号码格式：手机或固话</div>
        </div>

        <div class="text_info clearfix"><span>可选项：</span>
            <span style="color: green;">${insertSuccess}</span> <span style="color: red;">${insertError}</span>
        </div>
        <div class="input_info">
            <img src="/static/images/show.png" alt="展开" onClick="showOptionalInfo(this);"/>
        </div>

        <div id="optionalInfo" class="hide">
            <div class="text_info clearfix"><span>推荐人身份证号码：</span></div>
            <div class="input_info">
                <input type="text" onblur="idcardno(this.value)"/>
                <div class="validate_msg_long">正确的身份证号码格式</div>
            </div>
            <div class="text_info clearfix"><span>生日：</span></div>
            <div class="input_info">
                <input type="date" value="${account.birthdate}" name="birthdate"/>
            </div>
            <div class="text_info clearfix"><span>Email：</span></div>
            <div class="input_info">
                <input type="text" class="width350" value="${account.email}" name="email"/>
                <div class="validate_msg_tiny">50长度以内，合法的 Email 格式</div>
            </div>
            <div class="text_info clearfix"><span>职业：</span></div>
            <div class="input_info">
                <select name="occupation">
                    <option>干部</option>
                    <option>学生</option>
                    <option>技术人员</option>
                    <option>其他</option>
                </select>
            </div>
            <div class="text_info clearfix"><span>性别：</span></div>
            <div class="input_info fee_type">
                    <input type="radio" value="1" name="gender" id="female"/>
                    <label for="female">女</label>
                    <input type="radio" value="0" checked="checked" name="gender" id="male"/>
                    <label for="male">男</label>
            </div>
            <div class="text_info clearfix"><span>通信地址：</span></div>
            <div class="input_info">
                <input type="text" class="width350" value="${account.mailaddress}" name="mailaddress"/>
                <div class="validate_msg_tiny">50长度以内</div>
            </div>
            <div class="text_info clearfix"><span>邮编：</span></div>
            <div class="input_info">
                <input type="text" value="${account.zipcode}" name="zipcode"/>
                <div class="validate_msg_long">6位数字</div>
            </div>
            <div class="text_info clearfix"><span>QQ：</span></div>
            <div class="input_info">
                <input type="text" value="${account.qq}" name="qq"/>
                <div class="validate_msg_long">5到13位数字</div>
            </div>
        </div>

        <div class="button_info clearfix">
            <input id="submit"  type="submit" value="保存" class="btn_save"/>
            <input type="button" value="取消" class="btn_save" onclick="location.href='/account/account_list'"/>
        </div>
    </form>
</div>

<div id="footer">
    <span>[源自橡树的技术，最优秀的师资，最真实的企业环境，最适用的实战项目]</span>
    <br/>
    <span>版权所有(C)橡树信息科技有限公司 </span>
</div>
</body>
</html>
